animateProperty
Type
command
Summary
Change the value of a property of an object in an animated way
Syntax
animateProperty <pControl>, <pPropertyName>, <pEndValue>, [<pDuration>], [<pEasing> | <pAnimationOptions>]
Description
Use the animateProperty command to animate a property value of an object.
When pEndValue
is a reference to another control, the animation will
continuously update to match the target control's property value. This allows
for dynamic "following" behavior where one control can track another control's
property changes during the animation.
The library provides special transform properties that make it easy to move and scale objects:
- translateX/translateY: Move objects relative to their current position
- scaleX/scaleY: Scale width/height independently
- scaleXY: Scale both dimensions proportionally
These transform properties work similarly to CSS transforms and provide a convenient way to animate position and size changes.
Parameters
Name | Type | Description |
---|---|---|
pControl | The long id of a control. | |
pPropertyName | Name of the property you want to animate. The value of the passed property must be a number, a point, a color or a rectangle. The library also provides special transform properties:
| |
pEndValue | Final value of the property to animate to. Can be either:
| |
pDuration | Duration of the animation in seconds | |
pEasing | The easing method to use for the animation. Supported to get the list of these methods use the easingMethods function. | |
pAnimationOptions | This parameter is an array with the following keys.
|
Examples
set the label of me to 0
animateProperty the long id of me, "label", 100
# Animate to match another control's position
set the loc of button "Source" to 0,0
# If button "Target" moves during animation, button "Source" will track to its new position
animateProperty the long id of button "Source", "loc", \
the long id of button "Target", 3, "inOutElastic"
# Animate using library-specific transform properties
set the translateX of button "Move" to 0
animateProperty the long id of button "Move", "translateX", 200, 2, "outBounce"
set the scaleXY of image "Grow" to 100
animateProperty the long id of image "Grow", "scaleXY", 200, 1.5, "inOutElastic"
set the angle of image 1 to 0
animateProperty the long id of image 1, "angle", 360, 5, "inElastic"
set the top of me to 0
set the bottom of me to 0
animateProperty the long id of me, "rect", the rect of grc 1, 1, "outQuart"
set the backColor of me to empty
set the textSize of me to 12
animateProperty the long id of me, "backColor", any line of colorNames(), 1, "inExpo"
animateProperty the long id of me, "foreColor", any line of colorNames(), 1, "outQuint"
animateProperty the long id of me, "textSize", 32, 1, \
{ \
"easing": "inBack", \
"loop": "0", \
"direction": "normal", \
"autoPlay": "true", \
"delay": "0", \
"endDelay": "0" \
}
# Creating a batch of animations that start together
local tButton
put the long id of button "MyButton" into tButton
# Lock animations while setting up batch
lockAnimations
# Set up animations - none will start yet
animateProperty tButton, "left", 200, 2, "inOutQuad"
animateProperty tButton, "top", 100, 2, "outBounce"
animateProperty tButton, "width", 150, 2, "inElastic"
animateProperty tButton, "height", 80, 2, "outBack"
# Start all animations at once
unlockAnimations
Compatibility and Support
OS
mac
windows
linux
ios
android
Platforms
desktop
mobile
web